package 剑指offer;

/**
 * @description:
 * @author: ywk
 * @date: 2020-10-25
 */
public class 找到字符串的最长无重复字符子串 {
    public static void main(String[] args) {
        System.out.println(maxLength(new int[]{2,2,3,4,3}));
    }
    public static int maxLength (int[] arr) {
        int[] lastPos = new int[100005];
        int size = 0;
        for (int i : arr) {
            if (lastPos[i]==0) {
                size++;
                lastPos[i]=1;
            }
        }
        return size;
    }
}
